import tensorflow as tf

X = tf.Variable([[7, 0, -9], [0.55, -113, 12]], dtype=tf.float32);

cos = tf.cos(X)

d_cos = tf.gradients(cos, X)

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    
    print('------cos------')
    print(sess.run(cos))
    
    print('------d_cos------')
    print(sess.run(d_cos))